<div style="width:750px; float:left; padding-left:5px; margin-left:5px" class="border_radius">
<?php
	include_once("../../coms/xl_thongtin.php");
	include_once("../../include/ckeditor/ckeditor.php");
	$bn = new xl_thongtin();
	//$arr_bn = $bn->Load_Thong_Tin_Theo_Loai_Trang_va_ID(
	
	if(isset($_REQUEST['act']) && isset($_REQUEST['id'])):
		$act = $_REQUEST['act'];
		$id = $_REQUEST['id'];
		$maloaitrang = $_REQUEST['malt'];
		if($act == 'del' && is_numeric($id)):
			$xoa = new xl_thongtin();
			$kq2 = $xoa->Xoa_Thong_Tin_Theo_Loai_Trang_va_ID($maloaitrang, $id);			
			echo '<script type="text/javascript">
						alert("Xóa địa chỉ thành công!!!");	
						window.location="trangchu.php?key=qldc";				
					</script>';
		endif;
	endif;		
?>
<h2> <span style="color:#006"> Quản lý địa chỉ</h2>
<table width="100%" cellspacing="0" style="padding-left:5px; padding-right:5px" border="1px">
	<tr bgcolor="#996633">
    	<th align="center" valign="middle">
        	STT
        </th>
    	<th align="center" valign="middle">
        	Tên địa chỉ
        </th>
        <th align="center" valign="middle">
        	Thông tin địa chỉ
        </th>
        <th align="center" valign="middle">
        	Chức năng
        </th>
    </tr>
<?php
for ($i=0; $i<count($arr_bn); $i++):
	$row = $arr_bn[$i];
?>
    <tr style="border-bottom:#666;">
    	<td align="center" valign="middle">
        	<?php echo $i+1; ?>
        </td>
        <td align="center" valign="middle">
        	<?php echo $row['tenthongtin']; ?>
        </td>
    	<td align="center" valign="middle">
        	
            <table width="100%" cellpadding="0" cellspacing="0">
            	<tr>
                	<td style="color:#333">
                    	<?php 
							echo $row['noidung'];
						?>
                    						
                    </td>
                </tr>
            </table>
            
        </td>
        <td align="center" valign="middle">
       		<a href="trangchu.php?key=sdc&act=upd&malt=8&id=<?php echo $row['mathongtin']; ?>" class="button medium blue">Sửa</a>
        	<a href="trangchu.php?key=qldc&act=del&malt=8&id=<?php echo $row['mathongtin']; ?>" class="button medium blue" onclick="javascript: return confirm('Bạn chắc muốn xóa địa chỉ này không?');">Xóa</a>
        </td>
    </tr>
<?php
endfor;
?>
</table><br>

<form method="post" name="fr_themhinhanh" action="trangchu.php?key=qldc" enctype="multipart/form-data" >
    <table width="60%" align="center"  cellpadding="0" cellspacing="0" class="border_radius" style="font-size:12px">
        <tr>
            <td colspan="2" align="center" height="40px"><span style="font-size:18px; font-weight:bold; color:#f9d765; ">Thêm địa chỉ mới</span></td>
        </tr>
        <tr>
            <td width="30%" style="padding-left:5px;" height="30px" align="left">Tên địa chỉ<span style="color:#F00">(*)</span></td>
            <td align="left"><input type="text" name="txt_tenthongtin" size="30" style="height:20px;" class="border_radius"></td>
        </tr>
         <tr>
            <td colspan="2" align="left" style="vertical-align:middle;">
                &nbsp;Thông tin địa chỉ<br>
				<?php 
					$CKEditor_NoiDung = new CKEditor();
					$CKEditor_NoiDung->basePath = '../../include/ckeditor/';
					$CKEditor_NoiDung->config['height'] = 120;
					$CKEditor_NoiDung->config['width'] = 590;
					$CKEditor_NoiDung->editor("noidung","");
				?>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center" style="vertical-align:middle;">
                <input type="submit" name="btn_upload" value="Thêm mới" class="button small blue" style="margin-top:10px;"/>
            </td>
        </tr>
    </table>
</form><br>

</div>


<?php
 
if(isset($_POST['btn_upload']))
{
	$tendiachi = $_POST['txt_tenthongtin'];
	$noidung = $_POST['noidung'];
	$upload = new xl_thongtin();
	$ketqua = $upload->ThemDiaChi($tendiachi, $noidung);
	echo '<meta http-equiv="refresh" content="0;url=trangchu.php?key=qldc" />';
	
}

?>